package org.yohailong.studyreactfrombilibili.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.yohailong.studyreactfrombilibili.pojo.req.PublishCommentReq;
import org.yohailong.studyreactfrombilibili.pojo.response.Response;
import org.yohailong.studyreactfrombilibili.pojo.vo.CommentVO;
import org.yohailong.studyreactfrombilibili.service.CommentService;

import java.util.List;

/**
 * @author 朱海龙
 * 2025/9/7 14:33
 */
@RequestMapping("/comment")
@RestController
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("/list")
    public Response<List<CommentVO>> commentList() {
        return Response.success(commentService.commentList());
    }


    @PostMapping("/publishComment")
    public Response<Boolean> publishComment(@RequestBody @Validated PublishCommentReq req) {
        return Response.success(commentService.publishComment(req));
    }

}
